package com.chang.jason.viewpagerphoto;

import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private List<String> list=new ArrayList<>();

    private ViewPager viewPager;
    private MyViewPagerAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        list.add("http://a.hiphotos.baidu.com/image/pic/item/8cb1cb13495409231dd1835d9e58d109b3de495d.jpg");
        list.add("http://e.hiphotos.baidu.com/image/pic/item/3801213fb80e7bec00e429f3232eb9389b506be1.jpg");
        list.add("http://f.hiphotos.baidu.com/image/pic/item/c75c10385343fbf2f7da8133bc7eca8065388f2f.jpg");
        list.add("http://e.hiphotos.baidu.com/image/pic/item/ca1349540923dd54ca7e6840dd09b3de9c82488d.jpg");
        list.add("http://f.hiphotos.baidu.com/image/pic/item/42a98226cffc1e176741b1164690f603738de91f.jpg");

        viewPager=(ViewPager)findViewById(R.id.viewpager);
        adapter=new MyViewPagerAdapter(this,list);
        viewPager.setAdapter(adapter);

    }
}
